﻿<?php
	session_start();
	error_reporting (E_ALL ^ E_NOTICE);
	if($_SESSION["mem_pid"] != "" || $_SESSION["mem_pid"] != NULL){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>ADDIVITY</title>
		<link href="css/templatemo_style.css" rel="stylesheet" type="text/css" />
		<link href="css/jquery.ennui.contentslider.css" rel="stylesheet" type="text/css" media="screen,projection" />
	</head>
	<body>
		<div id="templatemo_header_wrapper">
			<div id="templatemo_header">
				<div id="site_title">
					<h1>
						<a href="" target="_parent">
							<img src="images/logo.jpg" alt="Logo" />
							<!-- <span>free website templates</span> -->
						</a>
					</h1>
				</div>
				<div id="search_box">
					<?php //include("./module/login_top.php"); ?>
				</div>
				<div class="cleaner"></div>
			</div>
			<div id="templatemo_menu">
				<ul>
					<?php include("./module/menu_ber_top.php"); ?>
				</ul>
			</div>
			<div id="templatemo_banner">
				<div id="one" class="contentslider">
					<div class="cs_wrapper">
						<div class="cs_slider">
							<?php
								include("./config/conn_database.php");
								$strSQL = "SELECT *
												FROM add_action_user
												WHERE pri_id = '". $_SESSION["pri_id"]."'";
								$objQuery = mysql_query($strSQL);
								while($objResult = mysql_fetch_array($objQuery)){
									echo "<div class='cs_article'>";
									echo "<div class='left'>";
									echo "<h2>".$objResult['act_topic']."</h2>";
									echo "<p>".$objResult['act_plot']."</p>";
									if($objResult['act_detail'] != "" || $objResult['act_detail'] != NULL)
										echo "<div class='button'><a href='#'>Read more</a></div>";
									echo "</div>";
									echo "<div class='right'>";
									echo "<a href='#' target='_parent'><img src='./images/act_image/".$objResult['act_image']."' alt='Image' /></a>";
									echo "</div>";
									echo "</div>";
								}
							?>
						</div>
					</div>
				</div>
				<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
				<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
				<script type="text/javascript" src="js/jquery.ennui.contentslider.js"></script>
				<script type="text/javascript">
					$(function() {
						$('#one').ContentSlider({
							width : '920px',
							height : '200px',
							speed : 800,
							easing : 'easeInOutBack'
						});
					});
				</script>
				<script src="js/jquery.chili-2.2.js" type="text/javascript"></script>
				<script src="js/chili/recipes.js" type="text/javascript"></script>
				<div class="cleaner"></div>
			</div>
		</div>
		<div id="templatemo_content_wrapper_outer">
			<div id="templatemo_content_wrapper_inner">
				<div id="templatemo_content_wrapper">
					<div id="templatemo_content">
						<?php
							echo "<table border='1' width='600'>";
								echo "<tr align='center'>";
									echo "<td><b>วันเดือนปี</b></td>";
									echo "<td><b>เรื่อง</b></td>";
									echo "<td><b>ผู้บันทึก</b></td>";
									echo "<td><b>แก้ไข</b></td>";
									echo "<td><b>ลบ</b></td>";
								echo "</tr>";
								$strSQL = "SELECT * FROM add_news, add_member WHERE add_news.mem_pid = add_member.mem_pid";
								$objQuery = mysql_query($strSQL);
								while($objResult = mysql_fetch_array($objQuery)){
									echo "<tr>";
										$yy = (substr($objResult['news_date'], 0, 4)+543);
										$mm = substr($objResult['news_date'], 4, 2);
										$dd = substr($objResult['news_date'], 6, 4);										
										echo "<td align='center' width='17%'>".$dd." / ".$mm." / ".$yy."</td>";
										echo "<td width='60%'>".$objResult['news_topic']."</td>";
										echo "<td align='center' width='15%'>".$objResult['mem_fname']."</td>";										
										echo "<td align='center' width='5%'><a href='edit_index_news_sql.php?act=edit&id=".$objResult['news_id']."'>แก้ไข</a></td>";
										echo "<td align='center' width='3%'><a href='edit_index_news_sql.php?act=del&id=".$objResult['news_id']."'>ลบ</a></td>";
									echo "</tr>";
								}
							echo "</table>";
							echo "<br /><br />";
							if($_GET['id']!=""||$_GET['id']!=NULL){
								$strSQL = "SELECT * FROM add_news WHERE news_id = '".$_GET['id']."'";
								$objQuery = mysql_query($strSQL);
								while($objResult = mysql_fetch_array($objQuery)){
									echo "<form name='form_setup_idea' action='edit_index_news_sql.php?act=edit_sql&id=".$_GET['id']."' method='post'>";
									echo "<h2>หัวข้อเรื่อง</h2>";
									echo "<input type='text' name='topic' size='90' maxlength='255' value='".$objResult['news_topic']."' />";
									echo "<br /><br />";
									echo "<h2>รายละเอียด</h2>";
									echo "<textarea name='detail' rows='10' cols='70' maxlength='255'>".$objResult['news_detail']."</textarea>";
									echo "<br /><br />";
									echo "<h2>อ้างอิง</h2>";
									echo "<input type='text' name='ref' size='90' maxlength='255' value='".$objResult['news_ref']."' />";
									echo "<br /><br />";
									echo "<input type='submit' name='Submit' value='Submit' alt='Submit' /> <input type='button' name='Cancel' value='Cancel' onclick='window.location = 'admin_menu.php' ' />";
									echo "</form>";
								}
							}else{							
						?>
						<form name="form_setup_idea" action="edit_index_news_sql.php" method="post">
						<h2>หัวข้อเรื่อง</h2>
						<input type="text" name="topic" size="90" maxlength="255" />
						<br /><br />
						<h2>รายละเอียด</h2>
						<textarea name="detail" rows="10" cols="70"></textarea>
						<br /><br />
						<h2>อ้างอิง</h2>
						<input type="text" name="ref" size="90" maxlength="255" />
						<br /><br />
						<input type="submit" name="Submit" value="Submit" alt="Submit" /> <input type="button" name="Cancel" value="Cancel" onclick="window.location = 'admin_menu.php' " />
						</form>
						<?php } ?>
					</div>
					<div id="templatemo_sidebar">
						<div id="news_section">
							<h2>Activity Now</h2>
							<?php
								$i=1;
								while($i<5){
									echo "<div class='news_box'>";
									echo "<a href='#'>Activity Nowa</a>";
									echo "<p>
											News bra bra bra. News bra bra bra. News bra bra bra. News bra bra bra. News bra bra bra. News bra bra bra.
										  </p>";
									echo "</div>";
									$i++;
								}
							?>
							<div class="cleaner"></div>  
						</div>
						<div class="section_rss_twitter">
							<?php
								$i=1;
								while($i<7){
									echo "<div class='rss_twitter twitter'>";
									echo "<a href='#' target='_parent'>Banner Name<span>Banner</span></a>";
									echo "</div>";
									echo "<div class='margin_bottom_20'></div>";
									$i++;
								}
							?>
						</div>
						<div class="cleaner"></div>
					</div>
					<div class="cleaner"></div>
				</div>
			</div>
		</div>
		<div id="templatemo_footer_wrapper">
			<div id="templatemo_footer">
				<ul class="footer_menu">
					<?php include("./module/menu_ber_top.php"); ?>
				</ul>
				Copyright © 2048 <a href="#">ADDIVITY</a> | 
				Designed by <a href="http://www.templatemo.com" target="_parent">templatemo.com</a>
			</div>
		</div>
	</body>
</html>
<?php
	mysql_close($objConnect);
}else{	
	echo "<script type='text/javascript'>";
	echo "alert('กรุณาเข้าสู่ระบบก่อนเข้าใช้งาน')";
	echo "</script>";
	echo "<meta http-equiv='refresh' content='0; url=index.php'>";
}
?>
